package cn.javaeye.lonlysky.lforum.service;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.hibernate.SimpleHibernateTemplate;

import cn.javaeye.lonlysky.lforum.entity.web.Article;

@Service
@Transactional
public class ArticleManager {

	private SimpleHibernateTemplate<Article, Integer> articleTypeDAO;

	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		articleTypeDAO = new SimpleHibernateTemplate<Article, Integer>(sessionFactory, Article.class);
	}

	/**
	 * 
	 * @return
	 */
	public List<Article> findAll() {
		return articleTypeDAO.findAll();
	}

	public void createFartherType(Article article) {
		articleTypeDAO.save(article);
	}
	public void remove(Integer id) {
		
		articleTypeDAO.delete(id);
	}
	public Article get(Integer id) {
		
		return articleTypeDAO.get(id);
	}
}
